<?php

// +----------------------------------------------------------------------
// |
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2030 http://www.jmzh1688.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: lxl
// +----------------------------------------------------------------------


namespace app\admin\controller;

use think\Controller;
use think\Db;

use app\admin\model\LogActionModel;


class Logaction extends Base
{
    public $name='';

        
    function __construct() {
        parent::__construct();
     
      
    }



    public function index()
    {

        
        if(request()->isAjax()){
            $param = input('param.');
            $limit = $param['pageSize'];
            $offset = ($param['pageNumber'] - 1) * $limit;
            $logactionmodel = new LogActionModel();


            $where = getWhereForm( $param);
            $where['isdelete']=0;

            $list = $logactionmodel->getByWhere($where, $offset, $limit);
            foreach($list as $key=>$vo){
                $list[$key]['operate'] = "";
            }
            $result['total'] = $logactionmodel->getAllCount($where);  // 总数据
            $result['rows'] = $list;
            return json($result);
        }


        return $this->fetch();
    }

    /**********************************LAYUI 基础版本修改 开始***********************************/
    /**
     * <layui 改版> 获取日志列表
     * @return mixed
     */
    public function ajaxGetSyslog(){

        if(request()->isAjax()){
            $param = input('');

            $limit = $param['limit'];
            $offset = $param['page'];
            $logactionmodel = new LogActionModel();

            //$where = getWhereForm( $param);
            $where['isdelete']=0;
            if($param['username']){
                $where['username']=$param['username'];
            }

            $list = $logactionmodel->getByWhere($where, $offset, $limit);

            $count = $logactionmodel->getAllCount($where);  // 总数据
            $result['rows'] = $list;
            if($list){
                $ret['data'] = $list;
                $ret['code'] = 0;
                $ret['msg']  = '获取数据成功';
                $ret['count'] = $count;
            }else{
                $ret['data'] = '';
                $ret['code'] = -1;
                $ret['msg']  = '获取数据为空';
                $ret['count'] = 0;
            }
            return $ret;
        }
    }



}
